home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 May: Tool Chest / Developer CD Series Tool Chest (Apple Computer)(May 1999).iso / Tool Chest / Development Kits / MPW Related / MPW Script Tips 1.1.1 / Sample Scripts / MyPrint < prev    next >
Encoding:
Text File  |  1991-08-16  |  2.7 KB  |  83 lines  |  [TEXT/MPS ]

  1. #----------------------------------------------------------------------------------------------------------------------------------------------------
  2. # MyPrint
  3. #    MPW Shell Script
  4. #    Written by Gina Cherry • August 16, 1991
  5. #    Copyright:    © 1991 by Apple Computer, Inc., all rights reserved.
  6. #    
  7. #    Usage: MyPrint files… -ps file
  8. #    
  9. #    Function:
  10. #            MyPrint prints one or more files specified on the command line, and a PostScript file, 
  11. #            which it sends to the LaserWriter prior to printing each page.   A sample PostScript file
  12. #            is included in this package.   MyPrint prompts the user to make sure that background 
  13. #            printing is turned off, since background printing must be turned off in order to print a 
  14. #            PostScript file from MPW.
  15. #----------------------------------------------------------------------------------------------------------------------------------------------------
  16.  
  17. # Initialize variables.
  18.     Set fileList ""
  19.     Set PSFile ""
  20.  
  21. # Don't exit on error.
  22.     Set Exit 0
  23.  
  24. # Loop through parameters.
  25.     Loop
  26.     
  27.     # Break if no more parameters.
  28.         Break If "{1}" == ""
  29.         
  30.     # If current parameter is -ps, get next parameter and set PSFile to it.
  31.         If "{1}" == '-ps'
  32.             Shift 1
  33.         #    Make sure a PostScript file was specified.
  34.             If "{1}"
  35.             #    Make sure ps option was not given more than once.
  36.                 If {PSFile} == ""
  37.                     Set PSFile "{1}"
  38.                 Else
  39.                     Echo "### {0}: Option ∂"-ps∂" multiply defined."
  40.                     Echo "### Usage: {0} files… -ps file" 
  41.                     Exit 1
  42.                 End 
  43.             Else
  44.                 Echo "### {0}: Must specify a PostScript file."
  45.                 Echo "### Usage: {0} files… -ps file" 
  46.                 Exit 1
  47.             End >> Dev:StdErr
  48.             
  49.     # Otherwise, add the current parameter to the file list.
  50.         Else 
  51.             Set fileList "{fileList} '{1}'"
  52.         End
  53.         
  54.     # Get next parameter.
  55.         Shift 1
  56.     End
  57.  
  58. # If no files in file list, write error message and exit script.
  59.     If "{fileList}" == ""
  60.         Echo "### {0}: No files to print." 
  61.         Echo "### Usage: {0} files… -ps file" 
  62.         Exit 1
  63.     End >> Dev:StdErr
  64.  
  65. #    If no PostScript file was specified, write error message and exit script.
  66.     If "{PSFile}" == ""
  67.         Echo "### {0}: No PostScript file given." 
  68.         Echo "### Usage: {0} files… -ps file" 
  69.         Exit 1
  70.     End >> Dev:StdErr
  71.     
  72. #    Make sure background printing is turned off
  73.     Confirm "Proceed only if background printing is off."
  74.  
  75. #    Exit script if Cancel was chosen.    
  76.     Exit If {Status} != 0
  77.     
  78. # Print files in file list using print options specified below, with the specified PostScript file in 
  79. #    the background.  In this example, all files will be printed in 10 point Monaco, and with a header. 
  80. #    Change these commands to conform to your printing preferences.For information on other print 
  81. #    options see the MPW Command Reference.
  82.     Print {fileList} -font Monaco -size 10 -h -ps "{PSFile}"
  83.